<?php
namespace app\home\logic;

use app\common\logic\Base;
use think\facade\App;

class Message extends  Base {
    
    /**
     * @desc 页面概述
     * @param $params
     * @return array
     * @throws \think\exception\DbException
     */
    public function index($params) {
        $list = App::model('Message')
            ->where(['msg_user_id' => $params['userId']])
            ->order('msg_id', 'desc')
            ->paginate($params['pageSize']);
        
        $pagination = $list->render();
        if($list) {
            $list = $list->toArray();
        }
        
        return [
            'list'         => output_format($list['data'], 'msg'),
            'pagination'   => $pagination
        ];
    }
}
